package com.wei.duowan.bbs.model;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * 作者：赵若位
 * 时间：2019/9/3 14:06
 * 联系方式：1070138445
 * 功能：头条标题
 */
public class NewsChannelBean implements Parcelable
{
    /*Channel固定不被选择的标签*/
    public static final Integer FIXED = 1;
    /**
     * channel_id : 11
     * c_name : LOL
     * sort : 987
     * r_type : 0
     * c_type : 0
     * sub_channel : [{"link_id":"7","title":"赛事","url":"","channel_id":"11","img":"http://s1.dwstatic.com/Apps/CC/C5/ccc5c094d3f220d8c7e8bedc0d0f61f94901.png","type":"0","sort":"100","update_time":"1526974626","prefecture":"lol","tags":"赛事新闻"},{"link_id":"8","title":"资讯","url":"","channel_id":"11","img":"http://s1.dwstatic.com/Apps/59/B5/59b59bc322ed5103b16c03f6829eef757776.png","type":"0","sort":"98","update_time":"1526974736","prefecture":"lol","tags":"资讯"},{"link_id":"9","title":"八卦","url":"","channel_id":"11","img":"http://s1.dwstatic.com/Apps/C4/A6/c4a61ee4b2fcf36c9a25a1e80d088c6c6283.png","type":"0","sort":"95","update_time":"1526974779","prefecture":"lol","tags":"撸圈八卦"},{"link_id":"10","title":"图集","url":"","channel_id":"11","img":"http://s1.dwstatic.com/Apps/A7/69/a769701d9db4fb82bd34addb79604df42767.png","type":"0","sort":"93","update_time":"1526974813","prefecture":"lol","tags":"比赛图集"},{"link_id":"11","title":"视频","url":"","channel_id":"11","img":"http://s1.dwstatic.com/Apps/2A/F2/2af2dc37e88764883b8a37b9d231e5677848.png","type":"0","sort":"90","update_time":"1526974842","prefecture":"lol","tags":"游戏视频"}]
     */

    /*渠道ID*/
    @SerializedName("channel_id")
    private String id;
    /*频道名字*/
    @SerializedName("c_name")
    private String name;
    /*排序*/
    private int sort;
    /*Channel固定*/
    private int r_type;
    /*标题描述*/
    private String descript;
    /*是否是标题*/
    private boolean isTitle;
    /*执行名称*/
    private String action;

    private int c_type;
    /*子菜单*/
    @SerializedName("sub_channel")
    private List<ChannelBean> channel;

    public NewsChannelBean()
    {

    }



    public NewsChannelBean(String id, String name, int sort, int r_type, String descript, boolean isTitle, String action, int c_type, List<ChannelBean> channel)
    {
        this.id = id;
        this.name = name;
        this.sort = sort;
        this.r_type = r_type;
        this.descript = descript;
        this.isTitle = isTitle;
        this.action = action;
        this.c_type = c_type;
        this.channel = channel;
    }


    protected NewsChannelBean(Parcel in)
    {
        id = in.readString();
        name = in.readString();
        sort = in.readInt();
        r_type = in.readInt();
        descript = in.readString();
        isTitle = in.readByte() != 0;
        action = in.readString();
        c_type = in.readInt();
        channel = in.createTypedArrayList(ChannelBean.CREATOR);
    }

    public static final Creator<NewsChannelBean> CREATOR = new Creator<NewsChannelBean>()
    {
        @Override
        public NewsChannelBean createFromParcel(Parcel in)
        {
            return new NewsChannelBean(in);
        }

        @Override
        public NewsChannelBean[] newArray(int size)
        {
            return new NewsChannelBean[size];
        }
    };

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public int getSort()
    {
        return sort;
    }

    public void setSort(int sort)
    {
        this.sort = sort;
    }

    public int getR_type()
    {
        return r_type;
    }

    public void setR_type(int r_type)
    {
        this.r_type = r_type;
    }

    public String getDescript()
    {
        return descript;
    }

    public void setDescript(String descript)
    {
        this.descript = descript;
    }

    public boolean getTitle()
    {
        return isTitle;
    }

    public void setTitle(boolean title)
    {
        isTitle = title;
    }

    public String getAction()
    {
        return action;
    }

    public void setAction(String action)
    {
        this.action = action;
    }

    public int getC_type()
    {
        return c_type;
    }

    public void setC_type(int c_type)
    {
        this.c_type = c_type;
    }

    public List<ChannelBean> getChannel()
    {
        return channel;
    }

    public void setChannel(List<ChannelBean> channel)
    {
        this.channel = channel;
    }

    @Override
    public int describeContents()
    {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i)
    {
        parcel.writeString(id);
        parcel.writeString(name);
        parcel.writeInt(sort);
        parcel.writeInt(r_type);
        parcel.writeString(descript);
        parcel.writeByte((byte) (isTitle ? 1 : 0));
        parcel.writeString(action);
        parcel.writeInt(c_type);
        parcel.writeTypedList(channel);
    }


    public static class ChannelBean implements Parcelable
    {
        /**
         * link_id : 7
         * title : 赛事
         * url :
         * channel_id : 11
         * img : http://s1.dwstatic.com/Apps/CC/C5/ccc5c094d3f220d8c7e8bedc0d0f61f94901.png
         * type : 0
         * sort : 100
         * update_time : 1526974626
         * prefecture : lol
         * tags : 赛事新闻
         */

        private String link_id;
        private String title;
        private String url;
        private String channel_id;
        private String img;
        private String type;
        private String sort;
        private String update_time;
        private String prefecture;
        private String tags;

        public ChannelBean()
        {

        }

        protected ChannelBean(Parcel in)
        {
            link_id = in.readString();
            title = in.readString();
            url = in.readString();
            channel_id = in.readString();
            img = in.readString();
            type = in.readString();
            sort = in.readString();
            update_time = in.readString();
            prefecture = in.readString();
            tags = in.readString();
        }

        public static final Creator<ChannelBean> CREATOR = new Creator<ChannelBean>()
        {
            @Override
            public ChannelBean createFromParcel(Parcel in)
            {
                return new ChannelBean(in);
            }

            @Override
            public ChannelBean[] newArray(int size)
            {
                return new ChannelBean[size];
            }
        };

        public String getLink_id()
        {
            return link_id;
        }

        public void setLink_id(String link_id)
        {
            this.link_id = link_id;
        }

        public String getTitle()
        {
            return TextUtils.isEmpty(title) ? "" : title;
        }

        public void setTitle(String title)
        {
            this.title = title;
        }

        public String getUrl()
        {
            return url;
        }

        public void setUrl(String url)
        {
            this.url = url;
        }

        public String getChannel_id()
        {
            return channel_id;
        }

        public void setChannel_id(String channel_id)
        {
            this.channel_id = channel_id;
        }

        public String getImg()
        {
            return img;
        }

        public void setImg(String img)
        {
            this.img = img;
        }

        public String getType()
        {
            return type;
        }

        public void setType(String type)
        {
            this.type = type;
        }

        public String getSort()
        {
            return sort;
        }

        public void setSort(String sort)
        {
            this.sort = sort;
        }

        public String getUpdate_time()
        {
            return update_time;
        }

        public void setUpdate_time(String update_time)
        {
            this.update_time = update_time;
        }

        public String getPrefecture()
        {
            return prefecture;
        }

        public void setPrefecture(String prefecture)
        {
            this.prefecture = prefecture;
        }

        public String getTags()
        {
            return tags;
        }

        public void setTags(String tags)
        {
            this.tags = tags;
        }

        @Override
        public int describeContents()
        {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel parcel, int i)
        {
            parcel.writeString(link_id);
            parcel.writeString(title);
            parcel.writeString(url);
            parcel.writeString(channel_id);
            parcel.writeString(img);
            parcel.writeString(type);
            parcel.writeString(sort);
            parcel.writeString(update_time);
            parcel.writeString(prefecture);
            parcel.writeString(tags);
        }
    }
}
